package org.lynn.javax.demo.jframe;

import java.awt.*;
import java.awt.geom.Ellipse2D;

/**
 * @author linzou@linkdoc.com
 * @ClassName: ValgHelper
 * @Description:
 * @date 2019/6/19 8:23 AM
 */
public class ValgHelper {

    private ValgHelper() {
    }

    public static void setStrokeWidth(Graphics2D g2d, int width) {
        g2d.setStroke(new BasicStroke(width, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
    }

    public static void strokeCircle(Graphics2D g2d, int x, int y, int r) {
        Ellipse2D circle = new Ellipse2D.Double(x - r, y - r, 2 * r, 2 * r);
        g2d.draw(circle);
    }

    public static void fillCircle(Graphics2D g2d, int x, int y, int r) {
        Ellipse2D circle = new Ellipse2D.Double(x - r, y - r, 2 * r, 2 * r);
        g2d.fill(circle);
    }

    public static void setColor(Graphics2D g2d, Color color) {
        g2d.setColor(color);
    }

    public static void pause(int t) {
        try {
            Thread.sleep(t);
        } catch (Exception e) {
            System.out.println("Error in sleeping");
        }
    }

}
